<%@page import="java.sql.*"%>
<head>
    <title>整表查询数据</title>
    <%!ResultSet rs;%>
    <%
        String dbName = "studb";
        String userName = "root";
        String userPasswd = "18023202";
        String url = "jdbc:mysql://localhost/" + dbName + "?user=" + userName + "&password=" + userPasswd;
        Class.forName("com.mysql.jdbc.Driver");
        Connection conn = DriverManager.getConnection(url);
        Statement statement = conn.createStatement();
        String sql = "select * from student";
        rs = statement.executeQuery(sql);
    %>
</head>
<body>
<table border="1">
    <tn colspan="4" style="font-size: x-large;alignment: center"> 学生信息表</tn>
    <tr style="text-align: center">
        <td>学号</td>
        <td>姓名</td>
        <tb>出生日期</tb>
        <tb>所在班级</tb>
    </tr>
    <% while (rs.next()){ %>
    <tr style="text-align: center">
        <td><%=rs.getString(1)%></td>
        <td><%=rs.getString(2)%></td>
        <td><%=rs.getString("birthday")%></td>
        <td><%=rs.getString("stuclass")%></td>
    </tr>
    <%   }   %>
    <%
        rs.close();
        statement.close();
        conn.close();
    %>
</table>
</body>